<template>
	<view>
		<view class="evaluate-dialog-view">
			<view class="top-rate">
				综合服务
				<view class="expand"></view>
				<uni-rate size="40" activeColor="red" :isFill="false" color="black" v-model="detailData.comprehensiveServices"></uni-rate>
				{{detailData.comprehensiveServices}}分
			</view>
			<view class="top-rate">
				服务态度
				<view class="expand"></view>
				<uni-rate size="40" activeColor="red" :isFill="false" color="black" v-model="detailData.servicesAttitude"></uni-rate>
				{{detailData.servicesAttitude}}分
			</view>
			<view class="top-rate">
				服务质量
				<view class="expand"></view>
				<uni-rate size="40" activeColor="red" :isFill="false" color="black" v-model="detailData.servicesQuality"></uni-rate>
				{{detailData.servicesQuality}}分
			</view>
			<view class="top-rate">
				系统使用
				<view class="expand"></view>
				<uni-rate size="40" activeColor="red" :isFill="false" color="black" v-model="detailData.sysUse"></uni-rate>
				{{detailData.sysUse}}分
			</view>
			<view class="text-evaluate">
				<view>文字评价</view>
				<textarea v-model="detailData.evaluate" placeholder="请简单评价下护士的服务"></textarea>
			</view>
			<view class="submit-btn" @click="submitEvaluate">提交</view>
		</view>
	</view>
</template>

<script>
	import * as orderInfo from '../../common/api/orderInfo.js'
	export default {
		data() {
			return {
				uid:'',
				detailData:{},
			}
		},
		onLoad(opt) {
			if(opt.uid){
				this.uid = opt.uid
				this.getData()
			}
		},
		methods: {
			getData(){
				const param = {
					uid:this.uid
				}
				orderInfo.queryById(param).then(result => {
					this.detailData = result.data.data
					this.handleDiagnosisProofList()
				}).catch(error => {
					console.log(error);
				})
			},
			submitEvaluate(){
				uni.showModal({
					title:"提示",
					content:"确认提交?",
					success:(res)=>{
						console.log(res);
						if(res.confirm){
							
							const param = Object.assign({},{
								uid:this.uid,
								evaluate:this.detailData.evaluate,//评价
								comprehensiveServices:this.detailData.comprehensiveServices,//综合服务
								servicesAttitude:this.detailData.servicesAttitude,//服务态度
								servicesQuality:this.detailData.servicesQuality,//服务质量
								sysUse:this.detailData.sysUse,//系统使用
								isEvaluate:'是',//是否已评价
							})
							console.log('param',JSON.stringify(param));
							orderInfo.update(param).then(result => {
								console.log('result',result);
								uni.navigateBack()
							}).catch(error => {
								console.log(error);
							})
							
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.evaluate-dialog-view{
	width: 100%;
	background: white;
	border-radius: 20rpx;
	box-sizing: border-box;
	padding: 30rpx;
	display: flex;
	flex-direction: column;
	.top-rate{
		display: flex;
		align-items: center;
	}
	.expand{
		width: 20rpx;
	}
	.text-evaluate{
		margin-top: 20rpx;
		margin-bottom: 20rpx;
	}
	textarea{
		border: solid 1rpx #D6D6D6;
		width: 100%;
		height: 200rpx;
		margin-top: 20rpx;
		padding: 10rpx;
		box-sizing: border-box;
	}
	.submit-btn{
		width: 100%;
		height: 80rpx;
		background: #0BC5AE;
		border-radius: 30rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		color: white;
	}
}
</style>
